package com.lg.product.service.impl;

import com.lg.product.entity.Category;
import com.lg.product.entity.SpecParam;
import com.lg.product.mapper.SpecParamMapper;
import com.lg.product.service.ICategoryService;
import com.lg.product.service.ISpecParamService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 规格参数组下的参数名 服务实现类
 * </p>
 *
 * @author song
 * @since 2020-07-22
 */
@Service
public class SpecParamServiceImpl extends ServiceImpl<SpecParamMapper, SpecParam> implements ISpecParamService {

    @Autowired
    private ICategoryService iCategoryService;

    /**
     * 规格 参数 查询
     * @return
     */
    public List<SpecParam> selectById(Integer id){
        List<SpecParam> specParams = baseMapper.selectById(id);
        return specParams;
    }

    /**
     * 规格 参数 添加
     * @param specParam
     * @return
     */
    public int addSpecParam(SpecParam specParam){
      baseMapper.addSpecParam(specParam);
        return 1;
    }

    /**
     * 规格 参数 删除
     * @param id
     * @return
     */
    public int deleteIdParam(Integer id){
        int i = baseMapper.deleteById(id);
       return i;
    }

    /**
     * 根据 规格分组 删除
     * @param groupId
     */
    @Override
    public Long deleteGroupIdParam(Long groupId) {
        Long i = baseMapper.deleteGroupIdParam(groupId.longValue());
        return i;
    }

    /**
     * 规格 参数 根据cid删除
     * @param cid
     * @return
     */
    @Override
    public Long deleteParamCid(Long cid) {
        Long aLong = baseMapper.deleteParamCid(cid);
        return aLong;
    }


}
